package com.ranqianhui.ojbackendquestionservice.controller.internal;

import com.ranqianhui.ojbackendmodel.model.entity.Question;
import com.ranqianhui.ojbackendmodel.model.entity.QuestionSubmit;
import com.ranqianhui.ojbackendquestionservice.service.QuestionService;
import com.ranqianhui.ojbackendquestionservice.service.QuestionSubmitService;
import com.ranqianhuii.ojbackendserviceclient.service.QuestionClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/inner")
public class QuestionControllerInternal implements QuestionClient {
    private QuestionService questionService;

    private QuestionSubmitService questionSubmitService;
    @GetMapping("/get/id")
    public Question getQuestionById(Long questionId) {
        Question question = questionService.getById(questionId);
        return question;
    }

    @GetMapping("/question_submit/get/id")
    public QuestionSubmit getQuestionSubmitById(Long questionSubmitId) {
        QuestionSubmit questionSubmit = questionSubmitService.getById(questionSubmitId);
        return questionSubmit;
    }

    @PostMapping("/question_submit/update")
    public Boolean updateById(QuestionSubmit questionSubmitUpdate) {
        return questionSubmitService.updateById(questionSubmitUpdate);
    }
}
